package com.it.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import com.it.model.Book;
import com.it.model.Chapter;
import com.it.model.SubUnsignInterventionResp;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;
import java.util.List;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2023/6/4 11:53 下午
 */
@SpringBootTest
public class IchapterServiceTestCase {

    @Autowired
    private IChapterService chapterService;

    @Test
    public void saveTest() {
        Chapter chapter = new Chapter(1L, 17L, "音乐", "二胡---", 0L, 0L);

        chapterService.save(chapter);
    }

    @Test
    public void saveBatchTest() {
        Chapter chapter1 = new Chapter(2L, 17L, "音乐", "二胡---", 0L, 0L);
        Chapter chapter2 = new Chapter(3L, 17L, "音乐", "二胡---", 0L, 0L);
        List<Chapter> list = new ArrayList<>();
        list.add(chapter1);
        list.add(chapter2);
        boolean res = chapterService.saveBatch(list);
        System.out.println(res);
    }

    @Test
    public void longTest() {
        Long l = 7072170584931592270l;
        if (l.longValue() < System.currentTimeMillis()) {
            System.out.println("ok");
        }
    }

    @Test
    public void testJSONParse() {
        String s = "{}";
        SubUnsignInterventionResp subUnsignInterventionResp = JSON.parseObject(s, SubUnsignInterventionResp.class);
        if (subUnsignInterventionResp == null) {
            System.out.println("ok");
        }
        System.out.println(subUnsignInterventionResp);
    }
}
